package com.symaster.common.swing.listener;

import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.JIntellitype;
import com.melloware.jintellitype.JIntellitypeConstants;


/**
 * 系统级快捷键监听
 *
 * @author yinmiao
 * @date 2021-08-31 09:49
 */
public class SystemShortcutManager implements JIntellitypeConstants {

    public static final int MOD_NONE = 0;
    public static final int F1 = 112;
    public static final int F2 = 113;
    public static final int F3 = 114;
    public static final int F4 = 115;
    public static final int F5 = 116;
    public static final int F6 = 117;
    public static final int F7 = 118;
    public static final int F8 = 119;
    public static final int F9 = 120;
    public static final int F10 = 121;
    public static final int F11 = 122;
    public static final int F12 = 123;
    public static final int ESC = 27;
    public static final int TAB = 9;
    public static final int CAPSLOCK = 20;
    public static final int SHIFT = 16;
    public static final int CTRL = 17;
    public static final int START_LEFT = 91;
    public static final int START_RIGHT = 92;
    public static final int CONTEXT_MENU = 93;
    public static final int ALT = 18;
    public static final int SPACE = 32;
    public static final int CARRIAGE_RETURN = 13;
    public static final int LINE_FEED = 10;
    public static final int BACK_SLASH = 220;
    public static final int BACK_SPACE = 8;
    public static final int INSERT = 45;
    public static final int DEL = 46;
    public static final int HOME = 36;
    public static final int END = 35;
    public static final int PAGE_UP = 33;
    public static final int PAGE_DOWN = 34;
    public static final int PRINT_SCREEN = 44;
    public static final int SCR_LK = 145;
    public static final int PAUSE = 19;
    public static final int LEFT_ARROW_KEY = 37;
    public static final int UP_ARROW_KEY = 38;
    public static final int RIGHT_ARROW_KEY = 39;
    public static final int DOWN_ARROW_KEY = 40;

    /**
     * 添加事件
     */
    public static void addListener(int identifier, int modifier, int keycode, HotkeyListener listener) {
        JIntellitype.getInstance().registerHotKey(identifier, modifier, keycode);
        JIntellitype.getInstance().addHotKeyListener(listener);
    }
}
